<!--
 * @Author: zhangxiangsheng 1026583651@qq.com
 * @Date: 2024-04-15 17:10:30
 * @LastEditors: libing 964368540@qq.com
 * @LastEditTime: 2024-06-05 19:03:39
 * @FilePath: \crm\pages\list\list.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <view>
    <!-- leftText="取消" :leftIcon="leftIcon" -->
    <u-navbar :title="title"></u-navbar>
    <formz ref="formz" :inputs="inputs" :data="data"></formz>
    <bottombox>
      <u-button type="error" :loading="loading" text="保存" @click="save"></u-button>
    </bottombox>
  </view>
</template>

<script>
import { NOTICE_TYPE_ARRAY, NOTICE_TYPE_MAP, DAY_TASK_ARRAY, DAY_TASK_MAP } from '@/contacts/calendar'
import { addCalendar } from "@/apis/customer/index"
export default {
  data() {
    return {
      leftIcon: "",
      title: "新建日程",
      data: {},
      loading: false,
      inputs: [
        { label: "日程内容", value: "name", iscard: "before", required: true },
        { label: "日程类型", value: "type", required: true, type: "select", option: DAY_TASK_ARRAY },
        { label: "开始时间", value: "startTime", type: "picker", required: true },
        { label: "结束时间", value: "endTime", type: "picker", required: true },
        {
          label: "通知时间", value: "notice", iscard: "after", type: "select", option: [
            { label: "提前15分钟", value: "1" },
            { label: "提前半小时", value: "2" },
            { label: "提前1小时", value: "3" },
            { label: "提前2小时", value: "4" },
            { label: "提前半天", value: "5" },
            { label: "提前1天", value: "6" }
          ]
        },
      ],
    };
  },
  methods: {
    async save() {
      let data = await this.$refs.formz.validate();
      this.loading = true;
      await addCalendar(data)
      this.loading = false;
      this.$z.back();
    }
  },
};
</script>

<style lang="scss" scoped>
page {
  background: #f2f4f5;
}
</style>
